<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {margin: 0;overflow: hidden;}
    #canvas {background-color: antiquewhite;}
  </style>
</head>
<body>
  <canvas id="canvas"></canvas>
  <script>
    /** @type {HTMLCanvasElement} */
    const canvas = document.querySelector('#canvas');
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;
    const ctx = canvas.getContext('2d');

    // 颜色
    ctx.fillStyle = 'red';
    ctx.lineWidth = 40;

    /* 面部 fillRect(x,y,w,h) */
    ctx.fillRect(50,250,400,200);

    /* 面部轮廓 stroke(x,y,w,h) */
    ctx.strokeRect(50,250,400,200);

    /* 眼罩 clearRect(x,y,w,h) */
    ctx.clearRect(50,300,400,60);

    /* 嘴巴: lineTo(x,y) */
    ctx.beginPath();
    ctx.moveTo(150,400);
    ctx.lineTo(350,400);
    ctx.stroke();

    /* 眼睛 arc(x,y,radio,start,end,direction) */
    ctx.beginPath();
    ctx.arc(150,330,20,0,Math.PI*2);
    ctx.moveTo(350-20,340);
    ctx.arc(350,340,20,Math.PI,0);
    ctx.fill();

    /* 天线 三次贝塞尔曲线 */
    ctx.beginPath();
    ctx.moveTo(50,50);
    ctx.bezierCurveTo(150,50,150,250,250,250);
    ctx.stroke();
    ctx.moveTo(450,50);
    ctx.bezierCurveTo(350,50,350,250,250,250);
    ctx.stroke();
  </script>
</body>
</html>